<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
		<link rel="stylesheet" href="/index.css" />
	</head>
	<body>
		<main>
			<h2>学生信息管理系统</h2>
			<form action="/query" class="query">
				<label for=""
					>姓名:
					<input type="text" name="username" />
				</label>
				<label for=""
					>性别
					<select name="sex" id="sex">
            <option value="">不限</option>
						<option value="男">男</option>
						<option value="女">女</option>
					</select>
				</label>
				<button type="submit">查询</button>

        <a href="/add">添加</a>
        <a href="#">首页</a>
        <div><a href="/prev">上一页</a><span>{{onepages}}/{{pages}}</span> <a href="/next">下一页</a></div>
      </form>
      {{if content.length > 0}}
        <table>
          <tr>
            <th>序号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>专业</th>
            <th>爱好</th>
            <th>删除</th>
            <th>编辑</th>
          </tr>
          
          {{each content}}
          <tr>
            <td>{{$index + 1}}</td>
            <td>{{$value.username}}</td>
            <td>{{$value.age}}</td>
            <td>{{$value.sex}}</td>
            <td>{{$value.zy}}</td>
            <td>
              {{each $value.hobby hobby}}
                {{hobby}}
              {{/each}}
            </td>
            <td><a href="/delete/{{$value._id}}">删除</a></td>
            <td><a href="/edit/{{$value._id.toString()}}">编辑</a></td>
          </tr>
          {{/each}}
        </table>
      {{else}}
			  <div>暂无数据</div>
			{{/if}}
		</main>
	</body>
</html>
